<?php
namespace Home\Model;
use Think\Model;
//文章信息表
class ArticleModel extends Model {
	//获取文章详情
	public function getInfo($id){
		$where = array(
			'aid' => $id	
		);
		$info = $this->where($where)->find();
		//获取文章的喜欢数量
		$like = D('like');
		$info['like_count'] = $like->getLikeCount($id);
		//获取文章的关注数量
		$attention = D('AttentionActicle');
		$info['attention_count'] = $attention->getAttentionCount($id);
		//获取文章的评论数量
		$comment = D('comment');
		$info['comment_count'] = $comment->getCommentCount($id);
		return $info;
	}
	//给文章的点击数加1
	public function addClick($id){
		$where = array(
			'aid' => $id	
		);
		$this->where($where)->setInc('click');
	}
}